// pages/roomdetail/newhousedetail.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    url: app.globalData.url,
    selected: true,
    selected1: false,
    selected2: false,
    selected3: false,
    moreinfo: "更多详细信息",
    morestate: false,
    movies: [
      /*{ url: 'http://bmbdc.com/bmxcximg/daybanner.png' },
      { url: 'http://bmbdc.com/bmxcximg/daybanner.png' },
      { url: 'http://bmbdc.com/bmxcximg/daybanner.png' },
      { url: 'http://bmbdc.com/bmxcximg/daybanner.png' },
      { url: 'http://bmbdc.com/bmxcximg/daybanner.png' },
      { url: 'http://bmbdc.com/bmxcximg/daybanner.png' },*/
    ],
    cur: 1,
    num: 0,
    // 计算器选择
    _num: 1,
    listData: [
      { "code": "1", "text": "8250", "type": "4083.33", "other": "4166.67", "all": "02" },
      { "code": "2", "text": "8250", "type": "4083.33", "other": "4166.67", "all": "02" },
      { "code": "3", "text": "8250", "type": "4083.33", "other": "4166.67", "all": "02" },
      { "code": "4", "text": "8250", "type": "4083.33", "other": "4166.67", "all": "02" },
      { "code": "5", "text": "8250", "type": "4083.33", "other": "4166.67", "all": "02" },
      { "code": "6", "text": "8250", "type": "4083.33", "other": "4166.67", "all": "02" },
      { "code": "7", "text": "8250", "type": "4083.33", "other": "4166.67", "all": "02" }
    ],
    dataList: {},
  },
  markers: [{
    //iconPath: "../../img/marker_red.png",
    id: 0,
    latitude: 40.002607,
    longitude: 116.487847,
    width: 35,
    height: 45
  }],

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var id = options.id;
    var that = this;
    wx.request({
      url: this.data.url + 'Smallprogram/newhouse/newhouse',
      data: {
        id: id,
      },
      success:function(res){
        console.log(res.data);
        var imageList = {};
        
        that.setData({
          dataList: res.data,
        });
        that.markers.latitude = res.data.house.areas.lat;
        that.markers.longitude = res.data.house.areas.lng;
      },
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    // 获得轮播图的数量
    var list = this.data.movies.length;
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  swiperChange: function (e) {
    var index = e.detail.current;
    this.setData({
      cur: index + 1
    })
  },
  selected: function (e) {
    this.setData({
      selected3: false,
      selected2: false,
      selected1: false,
      selected: true,
    })
  },
  selected1: function (e) {
    this.setData({
      selected3: false,
      selected2: false,
      selected1: true,
      selected: false,
    })
  },
  selected2: function (e) {
    this.setData({
      selected3: false,
      selected2: true,
      selected1: false,
      selected: false,
    })
  },
  selected3: function (e) {
    this.setData({
      selected3: true,
      selected2: false,
      selected1: false,
      selected: false,
    })
  },
  // 计算器选择
  clachose: function (e) {
    console.log(e.target.dataset.num)
    this.setData({
      _num: e.target.dataset.num
    })
  },
  //更多详细信息
  seeInfo: function(e){
    var state,info;
    if (this.data.morestate){
      state = false;
      info = "更多详细信息";
    }else{
      state = true;
      info = "收起";
    }
    this.setData({
      morestate: state,
      moreinfo: info,
    });
  },

})